﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Configuration;
using Hk.Core.General;

namespace Hk.Core
{
    public static class CurrentPortal
    {
        private static int _portalId;
        public static int PortalId
        {
            get
            {
                if (_portalId == 0)
                {
                    _portalId = WebConfigurationManager.AppSettings["PortalId"] != null ?
                        Convert.ToInt32(WebConfigurationManager.AppSettings["PortalId"]) :
                        Convert.ToInt32(HttpContext.Current.Session["PortalId"]);
                }
                return _portalId;
            }
        }
    }

    public partial class tbl_Blog_Portal
    {
        private HkEntities _db = new HkEntities();
        public string blogname
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.blogname.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }

        public string blogdescription
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.blogdescription.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }

        public string blogkeywords
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.blogkeywords.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string blogurl
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.blogurl.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string google_site_verification
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.google_site_verification.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string app_id
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.app_id.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string admins
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.admins.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string facebook
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.facebook.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string google
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.google.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string twitter
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.twitter.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string locale
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.locale.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string apple_touch_icon_144x144
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.apple_touch_icon_144x144.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string apple_touch_icon_72x72
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.apple_touch_icon_72x72.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string apple_touch_icon_57x57
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.apple_touch_icon_57x57.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string favicon
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.favicon.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
        public string image_src
        {
            get
            {
                var option_value = "";
                var value = this.tbl_Blog_Options.FirstOrDefault(a => a.option_name == Option.image_src.ToString());
                if (value != null)
                {
                    option_value = value.option_value;
                }
                return option_value;
            }
        }
    }
}
